<template>
  <view class="order-status">
    <!-- <block v-if="order.refund_type==1">
			<block v-if="order.refund_status==0">
				<block v-if="order.is_agree==0">等待审核中</block>
				<block v-else>
					<block v-if="order.is_user_send==0">已同意退货，请及时发货</block>
					<block v-else>已发货，待平台确认</block>
				</block>
			</block>
			<block v-if="order.refund_status==1">已同意退货并已退款</block>
			<block v-if="order.refund_status==3">已拒绝退货</block>
		</block>

		<block v-else>
			<block v-if="order.refund_status==0">等待审核中</block>
			<block v-if="order.refund_status==2">已同意换货</block>
			<block v-if="order.refund_status==3">已拒绝换货</block>
		</block> -->

    <view class="header-content">
      <viwe class="main-title">
        <image :src="statusTrans.imageSrc" alt=""></image>
        <text>{{ statusTrans.status }}</text>
      </viwe>
      <view class="subtitle" v-if="statusTrans.subtitle">{{
        statusTrans.subtitle
      }}</view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: {
    order: {
      type: Object,
      default: function () {
        return null;
      },
    },
  },
  computed: {
    statusTrans() {
      let status = "",
        subtitle = "",
        imageSrc = "";

      if (this.order.refund_type == 1) {
        if (this.order.is_user_cancel == 1) {
          status = this.$t('shop.cancled');
          subtitle = this.$t('order.userCan');
          imageSrc = this.asyncImgs.images.clock_icon;
        } else {
          if (this.order.refund_status == 0) {
            if (this.order.is_agree == 0) {
              status = this.$t('order.doing');
              subtitle = this.$t('order.waitCheck');
              imageSrc = this.asyncImgs.images.clock_icon;
            } else {
              if (this.order.is_user_send == 0) {
                status = this.$t('order.agreed');
                subtitle = this.$t('order.expressInfo');
                imageSrc = this.asyncImgs.images.clock_icon;
              } else {
                status = this.$t('order.doing');
                subtitle = this.$t('order.waitConfirm');
                imageSrc = this.asyncImgs.images.clock_icon;
              }
            }
          }
          if (this.order.refund_status == 1) {
            status = this.$t('order.agreed');
            subtitle = " "+this.$t('order.allRef');
            imageSrc = this.asyncImgs.images.done_icon;
          }
          if (this.order.refund_status == 3) {
            status = this.$t('shareholder.refuced');
            subtitle = " "+this.$t('order.refuce');
            imageSrc = this.asyncImgs.images.notice_icon;
          }
        }
      } else {
        if (this.order.refund_status == 0) {
          status = this.$t('order.doing');
          subtitle = " "+this.$t('order.waitCheck');
          imageSrc = this.asyncImgs.images.clock_icon;
        }
        if (this.order.refund_status == 2) {
          status = this.$t('order.agreed');
          subtitle = this.$t('admin.agreeExchange');
          imageSrc = this.asyncImgs.images.clock_icon;
        }
        if (this.order.refund_status == 3) {
          status = this.$t('shareholder.refuced');
          subtitle = this.$t('admin.notAgreeExchange');
          imageSrc = this.asyncImgs.images.notice_icon;
        }
      }

      return { status, subtitle, imageSrc };
    },
  },
};
</script>

<style lang="scss"scoped>
.order-status {
  width: 100%;
  padding: 40rpx 0;
  background: linear-gradient(90deg, #f1192a, #fc551b);
  display: flex;
  justify-content: center;
  align-items: center;

  .header-content {
    display: flex;
    flex-direction: column;
    padding-bottom: 24rpx;

    .main-title {
      font-size: 40rpx;
      font-family: PingFang SC;
      font-weight: 500;
      color: #ffffff;
      line-height: 44rpx;
      display: flex;
      justify-content: center;
      align-items: center;

      image {
        width: 38rpx;
        height: 38rpx;
        margin-right: 24rpx;
      }
    }
    .subtitle {
      font-size: 26rpx;
      font-family: PingFang SC;
      font-weight: 500;
      color: #ffffff;
      line-height: 44rpx;
      margin-top: 20rpx;
      text-align: center;
    }
  }
}
</style>
